
#include "video/SkeletalAnimation.h"
#include "video/SkeletonSerializer.h"

namespace KEngine
{


SkeletalAnimation::SkeletalAnimation()
{

}

SkeletalAnimation::~SkeletalAnimation()
{
	int numFrames = mFrameList.size();
	for (int i = 0; i < numFrames; ++i)
	{
		KSafeDelete(mFrameList[i]);
	}
	mFrameList.clear();
}

bool SkeletalAnimation::load(LPCTSTR filename)
{
	SkeletonSerializer serializer;
	return serializer.loadSkeletalAnimation(filename, this);
}

void SkeletalAnimation::addFrame(Frame* frame)
{
	mFrameList.push_back(frame);
}

SkeletalAnimation::Frame* SkeletalAnimation::getFrame(int idx)
{
	return mFrameList[idx];
}

int SkeletalAnimation::getNumFrames()
{
	return mFrameList.size();
}

}